//
//  UIView+UIViewController.swift
//  SinaWeibo
//
//  Created by 李江波 on 2016/11/26.
//  Copyright © 2016年 lijiangbo. All rights reserved.
//

import UIKit

extension UIView {
//通过响应者链条找导航控制器
    func findNavigationController() -> UINavigationController? {
        
        var responder = self.next
        
        while responder != nil {
            
            if let result = responder as? UINavigationController {
                
                return result
            }
            
            responder = responder?.next
        }
        
        return nil
    }
}
